'use strict';

module.exports = function countSameElements(collection) {
  let result=[];
  for(let i=0;i<collection.length;){
    let count=0;
    let object=new Object();
    for(let n=i;n<collection.length;n++){
      if(collection[n][0]==collection[i][0]){
        count++;
      }      
    }
    object.key=collection[i];
    object.count=count;
    result.push(object);
    i+=count;
  }
  return result;
}
